<?php

class Control_Homepage_Projects extends QUI_Control_Abstract
{
    function render()
    {
        $c = 'is_approbated = ? AND [owner.username] = ? AND is_homepage = ?';
        $this->_view['projects'] = Project::find($c, true, 'dualface', true)
            ->order('is_homepage_hot DESC, updated DESC')
            ->getAll();

        $c = 'is_approbated = ? AND is_picked = ? AND [owner.username] <> ?';
        $this->_view['picked_projects'] = Project::find($c, true, true, 'dualface')
            ->order('rating DESC, created DESC')
            ->top(20)
            ->getAll();

        return $this->_fetchView(dirname(__FILE__) . '/projects_view.php');
    }
}

